package az.mecid.rssreader.client.ui.widget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.*;

/**
 * Created by IntelliJ IDEA.
 * User: mega
 * Date: 17.03.2010
 * Time: 18:43:49
 */
public class FeedItemWidget extends Composite{
    interface Binder extends UiBinder<Widget,FeedItemWidget>{}

    public static Binder binder = GWT.create(Binder.class);

    @UiField
    HTML link;

    @UiField
    HTML text;

    public FeedItemWidget(String url,String title,String text){

        initWidget(binder.createAndBindUi(this));

        StringBuffer html = new StringBuffer();
        html.append("<a href='")
                .append(url)
                .append("'><h2>")
                .append(title)
                .append("</h2></a>");

        this.link.setHTML(html.toString());
        this.text.setHTML(text);
    }
}
